home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / vbcc / machines / amiga68k / doc / vclib.doc < prev   
Encoding:
Text File  |  1995-11-23  |  7.0 KB  |  247 lines

  1. vc.lib - C library for the Amiga68k version of vbcc
  2.  
  3.  
  4. INTRODUCTION
  5.  
  6.     vc.lib shall be an ANSI compliant C library for use with the
  7.     Amiga68k version of vbcc.
  8.  
  9.     It is written largely in C and some parts are not Amiga specific.
  10.  
  11.     At the moment only a part of the ANSI functions and includes is
  12.     there and many functions may not be ANSI compliant yet. It should
  13.     however contain the most frequently used functions and all those
  14.     that are used by vbcc itself.
  15.     You can also create a small data library (this one will probably
  16.     be in the archive already as vcs.lib), a small-code-version, a
  17.     020-version etc. or combinations of this (see COMPILING).
  18.  
  19.     Note that You have to link with a math library if You want to use
  20.     floating point. All math functions, special startup code and
  21.     printf/scanf functions which support floating point are contained in
  22.     the math libraries only.
  23.     At the moment There are two math libraries:
  24.  
  25.         mieee.lib   This one uses the C= math libraries. The startup code
  26.                     will always open MathIeeeSingBas.library,
  27.                     MathIeeeDoubBas.library and MathIeeeDoubTrans.library.
  28.                     Float return values are passed in d0, double return
  29.                     values are passed via pointers.
  30.                     A 68000 is sufficient to use this library.
  31.                     You must not specify -fpu=... when You use this library.
  32.  
  33.         m881.lib    This one uses direct FPU instructions and function
  34.                     return values are passed in fp0. You must have a
  35.                     68020 or higher and a FPU to use this library. You
  36.                     also have to specify -fpu=68881.
  37.                     Several FPU instructions that have to be emulated on
  38.                     040/060 may be used.
  39.                     (a math library for 040/060 might be done in the future)
  40.  
  41.     To link with one of those libraries add e.g. the -lmieee option to vc or
  42.     specify mieee.lib before vc.lib if You do the linking by hand.
  43.  
  44.     Some info about amiga.lib can be found in fd2lib.doc.
  45.  
  46.  
  47. LEGAL
  48.  
  49.     vc.lib is public domain. Certain parts have been taken from other
  50.     PD libraries (mainly libnix).
  51.     The same applies to m881.lib and mieee.lib.
  52.  
  53.  
  54. STARTUP etc.
  55.  
  56.     The startup code currently consists of a slightly modified standard
  57.     Amiga startup and the file _main.c. The startup code sets up some
  58.     global variables and initializes stdin, stdout and stderr.
  59.     The exit code closes all open files and frees all memory.
  60.     If You link with a math library the startup/exit code will be taken
  61.     from there if necessary.
  62.  
  63.  
  64. STDIO
  65.  
  66.     Most of the functions for buffered IO are implemented. The number of
  67.     open files is unlimited and they are handled with a linked list.
  68.     So You can not expect the arrays like used in most Unix compilers.
  69.     The non-ANSI functions like open(), read() etc. are not supported
  70.     either at the moment.
  71.  
  72.     The following functions are implemented at the moment:
  73.  
  74.     fopen()     binary and text modes are the same, ttys are unbuffered;
  75.                 line buffering is not possible at the moment
  76.     fclose()
  77.     fflush()
  78.     fgetc()
  79.     ungetc()
  80.     fputc()
  81.     fgets()
  82.     fputs()
  83.     fread()
  84.     fwrite()
  85.     gets()      never use it...
  86.     puts()
  87.     ftell()
  88.     fseek()
  89.     remove()
  90.     rename()
  91.     rewind()
  92.     setvbuf()
  93.     setbuf()
  94.     feof()
  95.     ferror()
  96.     prerror()
  97.     tmpnam()
  98.     tmpfile()   always returns an error at the moment
  99.     fgetpos()
  100.     fsetpos()
  101.     printf()    taken from libnix; link with a math library if You need fp
  102.     fprintf()     "
  103.     sprintf()     "
  104.     vprintf()     "
  105.     vfprintf()    "
  106.     vsprintf()    "
  107.     scanf()       "
  108.     fscanf()      "
  109.     sscanf()      "
  110.  
  111.  
  112. STDLIB
  113.  
  114.     The following functions do exist.
  115.  
  116.     malloc()    uses a variation of the example in K&R;
  117.                 currently allocates chunks of at least _nalloc*8 bytes;
  118.                 You can set _nalloc after an extern size_t _nalloc;
  119.     free()
  120.     calloc()
  121.     rand()      taken from libnix
  122.     srand()       "
  123.     system()    uses SystemTagList or Execute depending on OS version
  124.     abs()
  125.     labs()
  126.     div()       uses normal division; is this ok?
  127.     ldiv()        "
  128.     abort()
  129.     atexit()
  130.     getenv()    taken from libnix
  131.     qsort()       "
  132.     bsearch()     "
  133.     strtol()      "
  134.     strtoul()     "
  135.     atol()        "
  136.     atoi()        "
  137.     atof()      taken from libnix; link with a math library to use this
  138.     strtod()      "
  139.  
  140.  
  141. TIME
  142.  
  143.     Most standard functions should exist. Taken from libnix.
  144.     Link with a math library if You use difftime().
  145.  
  146.  
  147. STRING
  148.  
  149.     Most standard functions should exist.
  150.  
  151.  
  152. CTYPE
  153.  
  154.     Most standard functions should exist.
  155.  
  156.  
  157. LIMITS
  158.  
  159.     Taken from another library, but at least the standard integer limits
  160.     should be ok. No functions.
  161.  
  162.  
  163. FLOAT
  164.  
  165.     I do not know what has to be there, yet, but the most important things
  166.     should be there (and approximately correct). No functions.
  167.  
  168.  
  169. MATH
  170.  
  171.     You have to link with a math library to use these functions.
  172.     The following functions should be there, but they may be not precise
  173.     enough or otherwise not fully ANSI conform (e.g. errno is not set and
  174.     pow() with m881 is probably not good enough):
  175.  
  176.     sin(), cos(), tan()
  177.     sinh(), cosh(), tanh()
  178.     asin(), acos(), atan(), atan2()
  179.     exp(), log(), log10(), pow()
  180.     ceil(), floor()
  181.     sqrt()
  182.     fabs()
  183.     fmod()
  184.  
  185.  
  186. STDDEF
  187.  
  188.     Currently defines size_t, fpos_t, ptrdiff_t, wchar_t, time_t, clock_t,
  189.     NULL and offsetof. No functions.
  190.  
  191.  
  192. STDARG
  193.  
  194.     Defines va_list, va_start, va_arg and va_end. Seems to work well, but
  195.     vbcc gives an 'offset equals size of object' warning. No functions.
  196.  
  197.  
  198. ASSERT
  199.  
  200.     Not really tested yet. No functions.
  201.  
  202.  
  203. ERRNO
  204.  
  205.     The include file and errno is there, but most functions do not set
  206.     errno. No functions.
  207.  
  208.  
  209. SETJMP
  210.  
  211.     Oh well...I only wrote down some lines, but I doubt this really works.
  212.     Also I think there should be a special version for fpu.
  213.  
  214.  
  215. SIGNAL
  216.  
  217.     signal() and raise() are there, but always return an error.
  218.  
  219.  
  220. Again, there may be lots of errors or missing things in the include files
  221. and the library.
  222.  
  223.  
  224. COMPILING
  225.  
  226.     If You want to compile the libraries Yourself You should be able
  227.     to call the Make#?.script scripts from their directory and the rest
  228.     should be done automatically and the resulting .lib file will be
  229.     copied to vlib: (so take care You do not overwrite another library).
  230.     If You want to create special libraries (e.g. a vc.lib for 020+)
  231.     You have to edit the Make scripts.
  232.     E.g. to create the small-data-vcs.lib change add -sd in the
  233.     alias cc ... line and replace every following vc by vcs.
  234.  
  235.     Currently there is no small-data-version of the math libraries (it
  236.     should not make a difference with m881.lib, but with mieee.lib).
  237.  
  238.     Note however that You probably have to link with PhxLnk to use small data
  239.     or small code models and that You have to compile Your objects with
  240.     small data, too.
  241.  
  242.  
  243.  
  244.  
  245. Volker                                              volker@vb.franken.de
  246.  
  247.